<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head th:replace="head :: head"></head>
<body>
<div class="layui-layout layui-layout-admin">

    <div th:replace="menu :: menu"></div>

    <div class="layui-body" style="margin: 10px 0 0 20px;">
        <div class="js-search-bar" style="margin-top: 20px;">
            用户名称：
            <div class="layui-inline">
                <input class="layui-input" name="username" id="username" autocomplete="off"/>
            </div>
            <button class="layui-btn" data-type="searchUser">搜索</button>
        </div>
        <div class="layui-btn-group js-btn-group" style="margin: 10px 0 0 0;" sec:authorize="hasAuthority('ROLE_ADMIN')" >
            <button class="layui-btn layui-btn-small" data-type="addUser" title="新增"><i class="layui-icon"></i></button>
            <button class="layui-btn layui-btn-small" data-type="editUser" title="修改"><i class="layui-icon"></i></button>
            <button class="layui-btn layui-btn-small" data-type="deleteUser" title="删除"><i class="layui-icon"></i></button>
        </div>

        <table id="userTable" lay-filter="userTableTool"></table>

        <script type="text/html" id="userOptBar">
            <a class="layui-btn layui-btn-mini"  lay-event="assignRole" sec:authorize="hasAuthority('ROLE_ADMIN')">分配角色</a>
        </script>
    </div>

    <div th:replace="footer :: footer"></div>
</div>
<script src="http://cdn.jsdelivr.net/webjars/layui/2.1.2/layui.all.js"
        th:src="@{/layui/layui.all.js}"></script>
<script th:src="@{/app/user.js}"></script>
</body>

<div th:replace="user/edit :: userForm" ></div>
<div th:replace="user/assignRole :: assignRole" ></div>
</html>